"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
var app = getApp();
exports.default = Page({
  data: {
    status: "0"
  },
  onLoad: function onLoad() {
    var _this = this;
    var openid = wx.getStorageSync("openid");
    wx.request({
      url: app.globalData.host,
      data: {
        mod: "do",
        act: "type",
        ssid: openid,
        mid: "type"
      },
      method: "post", // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      header: {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      success: function success(res) {
        console.log(res);
        _this.setData({
          header: res.data.info
        });
      },
      fail: function fail() {
        // fail
      },
      complete: function complete() {
        // complete
      }
    });
    wx.request({
      url: app.globalData.host,
      data: {
        mod: "record",
        act: "user",
        ssid: openid,
        type: ""
      },
      method: "post", // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      header: {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      success: function success(res) {
        // success
        console.log(res);
        _this.setData({
          openid: openid,
          statistics: res.data.tab,
          spreadList: res.data.info
        });
      }
    });
  },
  setStyle: function setStyle(e) {
    var _this = this;
    var type = e.currentTarget.dataset.type;
    wx.request({
      url: app.globalData.host,
      data: {
        mod: "record",
        act: "user",
        ssid: _this.data.openid,
        opt: type
      },
      method: "post", // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      header: {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      success: function success(res) {
        // success
        //console.log(res);
        _this.setData({
          status: type,
          statistics: res.data.tab,
          spreadList: res.data.info
        });
      }
    });
  }
});